package cn.spring.test;

import cn.spring.dao.Ink;
import cn.spring.dao.Paper;

public class Printer {
    private Ink ink = null;
    private Paper paper = null;

    public Ink getInk() {
        return ink;
    }

    public Paper getPaper() {
        return paper;
    }

    public void setPaper(Paper paper) {
        this.paper = paper;
    }

    public void setInk(Ink ink) {
        this.ink = ink;
    }
    public void print(String str){
        //输出颜色标记
        System.out.println("使用"+ink.getColor(225,200,0)+"颜色打印:\n");
        //逐字符输出到纸张
        for (int i = 0; i < str.length(); i++) {
            paper.putInChar(str.charAt(i));
        }
        //输出内容
        System.out.println(paper.getContent());
    }
}
